import 'package:flutter/material.dart';
import 'today_tab.dart';
import 'task_list_tab.dart';

/// 应用主屏幕
/// 包含底部导航栏和两个tab页
class MainScreen extends StatefulWidget {
  const MainScreen({super.key});

  @override
  State<MainScreen> createState() => _MainScreenState();
}

class _MainScreenState extends State<MainScreen> {
  int _currentIndex = 0;

  final List<Widget> _tabs = [
    const TodayTab(),
    const TaskListTab(),
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('打卡提醒'),
        backgroundColor: Colors.blue,
        foregroundColor: Colors.white,
      ),
      body: _tabs[_currentIndex],
      bottomNavigationBar: BottomNavigationBar(
        currentIndex: _currentIndex,
        onTap: (index) {
          setState(() {
            _currentIndex = index;
          });
        },
        items: const [
          BottomNavigationBarItem(
            icon: Icon(Icons.check_circle),
            label: '今日打卡',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.list),
            label: '任务列表',
          ),
        ],
      ),
    );
  }
}